# change this to the path of SVDFeature
export SVDFEATURE=../svdfeature-gfmf

#--------------------------------------------------
export TOOLPATH=../$(SVDFEATURE)/tools
export CODEPATH=../../$(SVDFEATURE)/solvers/gfmf

# this make file is used to generate all the training file for 5-fold 
all:
	 rm -rf *~

train.txt test.txt: ../ml-1m/ratings.dat
	python/mkdata.py $(PRE) > info.txt

train.svdpp.uorder: train.txt
	$(TOOLPATH)/svdpp_randorder $+ $@ 10
test.svdpp.uorder: test.txt
	$(TOOLPATH)/svdpp_randorder $+ $@ 11

train.ugroup: train.txt  train.svdpp.uorder
	$(TOOLPATH)/line_reorder $+ $@
test.ugroup: test.txt  test.svdpp.uorder
	$(TOOLPATH)/line_reorder $+ $@

train.ugroup.imfb: train.svdpp.uorder
	python/mkemptyimfb.py $+ $@
test.ugroup.imfb: test.svdpp.uorder
	python/mkemptyimfb.py $+ $@

train.ugroup.imfb.feat: train.txt train.ugroup  
	python/mkimplicitfeedbackfeature.py $+ $@
test.ugroup.imfb.feat: train.txt test.ugroup  
	python/mkimplicitfeedbackfeature.py $+ $@

features/train.ugroup.UserID: train.ugroup
	python/mkUserID.py $+ 
features/test.ugroup.UserID: test.ugroup
	python/mkUserID.py $+ 

features/train.ugroup.ItemID: train.ugroup
	python/mkItemID.py $+
features/test.ugroup.ItemID: test.ugroup
	python/mkItemID.py $+ 

features/train.ugroup.tstamp: train.ugroup
	python/mkTstamp.py $+
features/test.ugroup.tstamp: test.ugroup
	python/mkTstamp.py $+

buffer.u$(PRE).train.ufcut: features/train.ugroup.UserID  features/train.ugroup.ItemID train.ugroup.imfb.feat features/train.ugroup.tstamp
	$(TOOLPATH)/kddcup_combine_ugroup train.ugroup buffer.u$(PRE).train.ufcut -u UserID -i ItemID -scale_score 4 -g tstamp -fd imfb.feat
buffer.u$(PRE).test.ufcut: features/test.ugroup.UserID  features/test.ugroup.ItemID test.ugroup.imfb.feat features/test.ugroup.tstamp
	$(TOOLPATH)/kddcup_combine_ugroup test.ugroup buffer.u$(PRE).test.ufcut -u UserID -i ItemID -scale_score 4 -g tstamp -fd imfb.feat
